Skip to main content

PUT Reencode Audio

Overview​


The following table contains information about the PUT method in regards for managing the process of reeoncoding a specific audio.

PUT Reencode Audio
MethodPUT
URL or Endpoint/api/v1/projectId/audios/audioId
HeadersAuthorization
ParametersaudioId, projectId
BodyCheck the request body below.

The description of the URL parameters is as follows:

URL Parameter NameMandatoryTypeDescription
projectIdYesstringUnique ID of the project.
audioIdYesstringUnique ID of the audio.

Request Body​

{
"downloadUrl": "https://example.com/{audioFile}",
"callBackUrl": "https://example.com/{callbackEndpoint}",
"hasDrm": true,
"folderId": 0,
"title": "{title}",
"author": "{author}",
"enableDuplicateCheck": true,
"uploadFileDetailsId": 0
}

Information about the fields that appear when you type in the request body are displayed in the table below.

Parameter NameMandatoryTypeDescription
downloadUrlYesstringThe source of the audio. For a file uploaded through the Upload API send the upload's requestKey (recommended) or the upload URL returned by the Upload API. Any other public URL is accepted unless the project setting encodeUploadedFilesOnly is on, in which case only a request key or a VP upload URL is accepted, see Uploaded files only.
callBackUrlNostringURL for callback after processing
hasDrmNobooleanIndicates if DRM is enabled
folderIdNointegerIdentifier of the folder
titleNostringTitle of the audio.
authorNostringAuthor on whose behalf the re-encode is requested. When the request references an upload and the project setting enforceUploadOwnership is on, it must match the author stored on that upload, see Upload ownership. It does not change the author of the audio.
enableDuplicateCheckNobooleanDetermines whether duplicate audios should be disallowed.
uploadFileDetailsIdNointegerThe ID of upload file details, as returned by the Upload API. Still accepted; sending the upload's requestKey in downloadUrl is recommended instead. When both are sent they must point at the same upload.
Upload ownership and uploaded files only

The same rules as for POST Audio apply to a re-encode: with enforceUploadOwnership on, the author must match the referenced upload (403 UPLOAD_AUTHOR_MISMATCH otherwise, identical for unknown references); with encodeUploadedFilesOnly on, the new source must be a request key or a VP upload URL (400 UPLOAD_REFERENCE_REQUIRED otherwise), and one that resolves to one of this project's uploads (rejected as an unknown reference otherwise). The audio is left unchanged when the request is rejected.

Response​

{
"success": true,
"errors": [],
"messages": [],
"result": {
"name": "{audioId}",
"originalFile": "https://cdn.vpplayer.tech/{projectId}/audio-encode/{audioId}/mp3/128kbps.mp3"
},
"resultInfo": null,
"statusCode": 200
}

Information about the fields that appear when you receive the response are displayed in the table below.

Top-Level Properties​

Field NameTypeDescription
successbooleanIf the response is successful it will return true. Otherwise will return false
errorsarray[string]Indicates if there was an error
messagesarray[string]Returns the response message from back-end
resultobjectReturns the response object
namestringUnique identifier of the audio
originalFilestringURL of the original audio file
resultInfostringReturns extra information about the result
statusCodeintegerReturns the HTTP Status Code

If the action is successful, the service sends back an HTTP 200 or 201 response.

Errors​

For information about the errors that are common to all actions, see Common Errors:

  • HTTP Status Code 400: Bad Request

    Includes the fixed code UPLOAD_REFERENCE_REQUIRED when the project only accepts uploaded files, see Uploaded files only.

  • HTTP Status Code 401: Unauthorized

  • HTTP Status Code 403: Forbidden

    Includes the fixed code UPLOAD_AUTHOR_MISMATCH when the project enforces upload ownership, see Upload ownership.

  • HTTP Status Code 404: Result Not Found

  • HTTP Status Code 500: Internal Server Error

  • HTTP Status Code 503: Backend Fetch Failed